﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter11.Code02.Code02.Snippet06
{
    public class AddClass1
    {
        public int Val;

        public static AddClass1 operator +(AddClass1 op1, AddClass1 op2)
        {
            AddClass1 returnVal = new AddClass1();
            returnVal.Val = op1.Val + op2.Val;
            return returnVal;
        }

        public static AddClass1 operator -(AddClass1 op1)
        {
            AddClass1 returnVal = new AddClass1();
            returnVal.Val -= op1.Val;
            return returnVal;
        }

        public static AddClass3 operator +(AddClass1 op1, AddClass2 op2)
        {
            AddClass3 returnVal = new AddClass3();
            returnVal.Val = op1.Val + op2.Val;
            return returnVal;
        }

        public static AddClass3 operator +(AddClass2 op1, AddClass1 op2)
        {
            return op2 + op1;
        }
    }
}
